#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

void Swap(int* p1, int* p2)
{
	int tmp = *p1;
	*p1 = *p2;
	*p2 = tmp;
}

void BubbleSort(int* a, int n)
{
	for (int i = 0; i < n - 1; i++)
	{
		for (int j = 0; j < n - 1 - i; j++)
		{
			if (a[j] > a[j + 1])
				Swap(&a[j], &a[j + 1]);
		}
	}
}

int main()
{
	int a[] = { 3,1,9,5,7,2,6,4,8 };
	int sz = sizeof(a) / sizeof(a[0]);
	BubbleSort(a, sz);
	return 0;
}